package com.woyou.ui.activity.orderdetail;

import android.view.View;

import com.citaq.ideliver.R;
import com.woyou.ui.fragment.CancelOrderLayout;
import com.woyou.ui.fragment.ConReceivTimeOrder;

/**
 * 确认订单状态返回按键命令
 * @author zhou
 *
 */
public class ConfirmedBackCommand extends BackCommand {
	
	/** 确认订单的pop **/
	private ConReceivTimeOrder confirmOrderPop;
	
	/** 取消订单的pop **/
	private CancelOrderLayout cancelOrderPop;
	
	public ConfirmedBackCommand(ViewControl view) {
		super(view);
		findView();
		
	}

	@Override
	public void execute() {
		if ( confirmOrderPop!=null ) {
			if ( confirmOrderPop.getVisibility() == View.VISIBLE ) {
				confirmOrderPop.setVisibility(View.GONE);
				confirmOrderPop.clear();
				return;
			} 
		} 
		
		if( cancelOrderPop!=null ) {
			if ( cancelOrderPop.getVisibility() == View.VISIBLE ){
				cancelOrderPop.setVisibility(View.GONE);
				return;
			} 
		}
		
		mControllView.back();
		
	}

	@Override
	protected void findView() {
		confirmOrderPop = (ConReceivTimeOrder) mActivity.findViewById(R.id.confirm_order);
		cancelOrderPop = (CancelOrderLayout) mActivity.findViewById(R.id.cancel_order);
		
	}

}
